<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pretty="http://ocpsoft.com/prettyfaces"
	xmlns:security="http://www.springframework.org/security/facelets/tags"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition>
	<security:isAnonymous>
		<div class="box">
			<h2>
				<a id="toggle-login-form" href="#"><h:outputText
						value="#{msg['loginLogoutMenu.loginForm']}" /></a>
			</h2>
			<div id="login-form" class="block login-forms">
				<h:form prependId="false">
					<fieldset class="login">
						<legend>
							<h:outputText value="#{msg['loginLogoutMenu.login']}" />
						</legend>
						<p class="notice">
							<h:outputText value="#{msg['loginLogoutMenu.loginNotice']}" />
						</p>

						<p:message for="loginButton" showSummary="false" />
						<p:message for="login" showSummary="false" />
						<p>
							<label><h:outputText
									value="#{msg['loginLogoutMenu.email']}" /></label>
							<p:inputText id="login" value="#{loginBean.login}"
								required="true" label="#{msg['loginLogoutMenu.email1']}" />
						</p>

						<p:message for="password" showSummary="false" />
						<p>
							<label><h:outputText
									value="#{msg['loginLogoutMenu.pass']}" /></label>
							<p:inputText id="password" value="#{loginBean.pass}"
								type="password" required="true"
								label="#{msg['loginLogoutMenu.password1']}" />
						</p>

						<p:commandButton id="loginButton" action="#{loginBean.validate}"
							binding="#{loginBean.button}" ajax="false"
							value="#{msg['loginLogoutMenu.loginButton']}" style="width: 100%" />
					</fieldset>
				</h:form>
				<h:form>
					<fieldset>
						<legend>
							<h:outputText value="#{msg['loginLogoutMenu.register']}" />
						</legend>

						<p>
							<h:outputText value="#{msg['loginLogoutMenu.registerNotice']}" />
						</p>
						<p:commandButton action="pretty:register"
							value="#{msg['loginLogoutMenu.registerButton']}"
							style="width: 100%" />
					</fieldset>
				</h:form>
			</div>
		</div>
	</security:isAnonymous>

	<security:isAuthenticated>
		<div class="box">
			<h2>
				<a id="toggle-logout" href="#"><h:outputText
						value="#{msg['loginLogoutMenu.logoutForm']}" /></a>
			</h2>
			<div id="logout" class="block login-forms">
				<h:form>
					<fieldset>
						<legend>
							<h:outputText value="#{msg['loginLogoutMenu.loggedUser']}" />
						</legend>
						<table>
							<tbody>
								<tr>
									<th style="background-color: #FFF"><h:outputText
											value="#{msg['loginLogoutMenu.user']}" /></th>
									<td style="background-color: #FFF"><h:outputText
											value="#{userInfoBean.login}" /></td>
								</tr>
								<tr>
									<th style="background-color: #FFF"><h:outputText
											value="#{msg['loginLogoutMenu.lastLogin']}" /></th>
									<td style="background-color: #FFF"><h:outputText
											value="#{userInfoBean.lastLogin}" /></td>
								</tr>
								<tr>
									<th style="background-color: #FFF"><h:outputText
											value="#{msg['loginLogoutMenu.created']}" /></th>
									<td style="background-color: #FFF"><h:outputText
											value="#{userInfoBean.createDate}" /></td>
								</tr>
							</tbody>
						</table>

						<p:commandButton action="pretty:logout"
							value="#{msg['loginLogoutMenu.logoutButton']}"
							style="width: 100%" />
					</fieldset>
				</h:form>
			</div>
		</div>
	</security:isAuthenticated>
</ui:composition>

</html>
